package com.yz.common.utils;


/**
 * Created With IntelliJ IDEA.
 * Descriptions:验证类
 * <p>
 * User:Mr.Du
 * Date:2024/3/18
 * Time:17:40
 */
public class VerifyUtils {

    public static boolean isEmail(String email) {
        return email.matches("^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$");
    }

    public static StringBuffer randomCode() {
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < 6; i++) {
            sb.append((int) (Math.random() * 10));
        }
        return sb;
    }
}
